<%@page import="com.gopay.remote.solution.vo.PayChannelDtlInfo"%>
<%@page import="com.gopay.common.constants.trans.PayChannel"%>
<%@page import="com.gopay.cashier.domain.bean.PayChannelDtlBean"%>
<%@page import="com.gopay.common.constants.trans.PayChannelType"%>
<%@page import="com.gopay.cashier.domain.bean.PayChannelWayBean"%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="../common/init_context.jsp"%>
<%@ page import="java.util.List"%>
<%
	int moreBanks = 15;
	PayChannelWayBean pw=(PayChannelWayBean)request.getAttribute("payWayBean");
	PayChannelDtlBean pcb = pw.getPayChannelDtl(PayChannelType.OUTSTLM_PAY.value);
	List<PayChannelDtlInfo> personBanks = pcb.getBankCodes().get(PayChannel._01.value);
	List<PayChannelDtlInfo> corpBanks =  pcb.getBankCodes().get(PayChannel._51.value);
	int pbankNums = personBanks==null?0:personBanks.size();
	int ebankNums = corpBanks==null?0:corpBanks.size();
	String userType = request.getAttribute("userType").toString();
	if(userType.equals("1")){
		ebankNums = 0;
	}
	if(userType.equals("2")){
		pbankNums = 0;
	}
%>
<c:set var="pbankNum" value="<%=pbankNums %>"/>
<c:set var="ebankNum" value="<%=ebankNums %>"/>

<script type="text/javascript" src="${ROOT}/static/js/gopay/bankPayChannel.js"></script>
<script type="text/javascript">
var pbankNum = '<%=pbankNums %>';
var ebankNum = '<%=ebankNums %>';
</script>


<form name="bankPayForm" id="bankPayForm" action="${ROOT}/pay/bpc.shtml?orderKey=<%=request.getParameter("orderKey")%>&orderId=<%=request.getParameter("orderId")%>" method="post">
<div class="tabscon" id="bankPayTab">
	<div class="titleBox-1">
		<ul class="selectBank">
			<li><span class="zoom width134">选择银行类型：</span>
			<c:if test='${(pbankNum gt 0) }'>
				<input type="radio" id="personalBank" name="payChannel" value="01"><label class="cur zoom width214">个人网上银行支付</label>
			</c:if>
			<c:if test="${ebankNum gt 0}">
				<input type="radio" class="verticalMiddle" id="corpBank" name="payChannel"  value="51"><label>企业网上银行支付</label>
			</c:if>
			</li>
		</ul>
	</div>
	<c:if test='${(pbankNum gt 0) }'>
	<table class="table-tml-3" id="personalBankList">
		<tbody>
			<%
				//输出个人银行的图标
				for(int i=0; i<pbankNums&&i<moreBanks; i++){
					PayChannelDtlInfo info = personBanks.get(i);
					String bc = info.getOutStlmId();
					if(i!=0&&i%3==0)out.print("</tr>");
					if(i%3==0)out.print("<tr>");
					if(i==0){
						out.print("<th rowspan=\"5\">选择支付银行：</th>");
					}
					out.print("<td>\n");
					out.print("<input type='radio' id='i_b_c_"+i+"' name='personalPayBankCode' value='"+bc+"'>\n");
					out.print("<img width='190' height='36' border='0' src='"+request.getContextPath()+"/BankIcon/"+bc+".jpeg' onclick=\"bankSel('i_b_c_"+i+"',this);\" alt='"+bc+"' style='cursor:pointer'/>\n");
					out.print("</td>\n");
				}
					out.print("</tr>");
			if(pbankNums>moreBanks){
				%>
			<tr>
				<td colspan="4" align="right"><a  href="javascript:void(0);" class="more" onclick="showAllBanks('01');">更多银行</a></td>
			</tr>
			<%} %>
			<tr>
				<td colspan="4" align="center">
				<button type="button" class="btn-1" onclick="bankPaySubmit('01','bankPayForm');">下一步</button>
				<%-- <c:if test='${inc == "y"}'>
					<a href="${incUrl }" class="incharge-link">返回充值页面</a>
				</c:if> --%>
				</td>
			</tr>
		</tbody>
	</table>
	</c:if>
	<c:if test='${ebankNum gt 0 }'>
	<table class="table-tml-3" id="corpBankList">
		<tbody>
			<%
			//输出企业银行的图标
			for(int i=0; i<ebankNums && i<moreBanks; i++){
				PayChannelDtlInfo info = corpBanks.get(i);
			    String bc = info.getOutStlmId();
				if(i!=0&&i%3==0)out.print("</tr>");
				if(i%3==0)out.print("<tr>");
				if(i==0){
					out.print("<th rowspan=\"5\">选择支付银行：</th>");
				}
				out.print("<td>\n");
				out.print("<input type='radio' id='e_b_c_"+i+"' name='corpPayBankCode' value='"+bc+"'>\n");
				out.print("<img width='190' height='36' border='0' src='"+request.getContextPath()+"/BankIcon/"+bc+".jpeg' onclick=\"bankSel('e_b_c_"+i+"',this);\" alt='"+bc+"' style='cursor:pointer'/>\n");
				out.print("</td>\n");
			}
				out.print("</tr>");
			if(ebankNums>moreBanks){
			%>
			<tr>
				<td colspan="4" align="right"><a  href="javascript:void(0);" class="more"  onclick="showAllBanks('51');">更多银行</a></td>
			</tr>
			<%} %>
			<tr>
				<td colspan="4" align="center">
				<button type="button" class="btn-1" onclick="bankPaySubmit('51','bankPayForm');">下一步</button>
				<%-- <c:if test='${inc == "y"}'>
					<a href="${incUrl }" class="incharge-link">返回充值页面</a>
				</c:if> --%>
				</td>
			</tr>
		</tbody>
	</table>
	</c:if>
</div>
	<input type="hidden" name="orderId" id="orderId" value="<%=request.getParameter("orderId")%>"/>
	<input type="hidden" name="formhash" id="formhash" value="${formhash }"/>
	<input type="hidden" name="gopayUser" id="gopayUser" value="${sessionScope.gopayUser }"/>
	<input type="hidden" name="pageFrom" value="order"/>
	<input type="hidden" name="gopayAcctId" id="gopayAcctId" value="${gopayAcctId }"/>
    <input type="hidden" name="orderKey" id="orderKey" value="<%=request.getParameter("orderKey")%>"/>
</form>





<div id="allPersonBanksDialog" style="display:none">
<form name="allPersonBankPayForm" id="allPersonBankPayForm" action="${ROOT}/pay/bpc.shtml?orderKey=<%=request.getParameter("orderKey")%>&orderId=<%=request.getParameter("orderId")%>" method="post">
<table class="table-tml-3" style="width:750px">
<tbody>
<%
if(pbankNums>moreBanks){
	//输出个人银行的图标
	for(int i=0; pw!=null && i<personBanks.size(); i++){
		PayChannelDtlInfo info = personBanks.get(i);
		String bc = info.getOutStlmId();
		if(i!=0&&i%3==0)out.print("</tr>");
		if(i%3==0)out.print("<tr>");
		out.print("<td>\n");
		out.print("<input type='radio' id='a_i_b_c_"+i+"' name='personalPayBankCode' value='"+bc+"'>\n");
		out.print("<img width='190' height='36' border='0' src='"+request.getContextPath()+"/BankIcon/"+bc+".jpeg' onclick=\"bankSel('a_i_b_c_"+i+"',this);\" alt='"+bc+"' style='cursor:pointer'/>\n");
		out.print("</td>\n");
	}
		out.print("</tr>");
}
%>
</tbody>
</table>
<table class="table-tml-3" style="width:750px">
	<tbody>
		<tr>
			<td align="center">
			<button class="btn-1" type="button" onclick="bankPaySubmit('01','allPersonBankPayForm');">下一步</button>
			<%-- <c:if test='${inc == "y"}'>
					<a href="${incUrl }" class="incharge-link">返回充值页面</a>
				</c:if> --%>
			</td>
		</tr>
	</tbody>
</table>
	<input type="hidden" name="orderId" id="orderId" value="<%=request.getParameter("orderId")%>"/>
	<input type="hidden" name="formhash" id="formhash" value="${formhash }"/>
	<input type="hidden" name="gopayUser" id="gopayUser" value="${sessionScope.gopayUser }"/>
	<input type="hidden" name="pageFrom" value="order"/>
	<input type="hidden" name="payChannel" value="01"/>
	<input type="hidden" name="gopayAcctId" id="gopayAcctId" value="${gopayAcctId }"/>
    <input type="hidden" name="orderKey" id="orderKey" value="<%=request.getParameter("orderKey")%>"/>
</form>
</div>

<div id="allCorpBanksDialog" style="display:none">
<form name="allCorpBankPayForm" id="allCorpBankPayForm" action="${ROOT}/pay/bpc.shtml?orderKey=<%=request.getParameter("orderKey")%>&orderId=<%=request.getParameter("orderId")%>" method="post">
<table class="table-tml-3" style="width:750px">
<tbody>
<%
if(ebankNums>moreBanks){
//输出企业银行的图标
	for(int i=0; pw!=null && i<corpBanks.size(); i++){
		PayChannelDtlInfo info = corpBanks.get(i);
	    String bc = info.getOutStlmId();
		if(i!=0&&i%3==0)out.print("</tr>");
		if(i%3==0)out.print("<tr>");
		out.print("<td>\n");
		out.print("<input type='radio' id='a_e_b_c_"+i+"' name='corpPayBankCode' value='"+bc+"'>\n");
		out.print("<img width='190' height='36' border='0' src='"+request.getContextPath()+"/BankIcon/"+bc+".jpeg' onclick=\"bankSel('a_e_b_c_"+i+"',this);\" alt='"+bc+"' style='cursor:pointer'/>\n");
		out.print("</td>\n");
	}
		out.print("</tr>");
}
%>
</tbody>
</table>
<table class="table-tml-3" style="width:750px">
	<tbody>
		<tr>
			<td align="center">
			<button class="btn-1" type="button" onclick="bankPaySubmit('51','allCorpBankPayForm');">下一步</button>
			<%-- <c:if test='${inc == "y"}'>
					<a href="${incUrl }" class="incharge-link">返回充值页面</a>
				</c:if> --%>
			</td>
		</tr>
	</tbody>
</table>
	<input type="hidden" name="orderId" id="orderId" value="<%=request.getParameter("orderId")%>"/>
	<input type="hidden" name="formhash" id="formhash" value="${formhash }"/>
	<input type="hidden" name="gopayUser" id="gopayUser" value="${sessionScope.gopayUser }"/>
	<input type="hidden" name="pageFrom" value="order"/>
	<input type="hidden" name="payChannel" value="51"/>
	<input type="hidden" name="gopayAcctId" id="gopayAcctId" value="${gopayAcctId }"/>
    <input type="hidden" name="orderKey" id="orderKey" value="<%=request.getParameter("orderKey")%>"/>
</form>
</div>